package com.mef.smsplat.service;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.mef.smsplat.dao.CompanyInfoDao;
import com.mef.smsplat.dao.base.DataGridModel;
import com.mef.smsplat.dao.base.EntityDao;
import com.mef.smsplat.dao.base.Page;
import com.mef.smsplat.domain.CompanyInfoDomain;
import com.mef.smsplat.service.base.BaseService;

@Service
@Transactional
public class CompanyInfoService extends BaseService<CompanyInfoDomain, String> {
	
	private CompanyInfoDao companyInfoDao;
	
	/**增加setXXXX()方法,spring就可以通过autowire自动设置对象属性,请注意大小写*/
	public void setCompanyInfoDao(CompanyInfoDao companyInfoDao) {
		this.companyInfoDao =companyInfoDao;
	}
	@Override
	public EntityDao getEntityDao() {
		return this.companyInfoDao;
	}
	
	/**
	 * 根据公司名 OFFICE IADA分页查询信息
	 * @param companyName
	 * @param office
	 * @param iada
	 * @param dgm
	 * @return
	 */
	@Transactional(readOnly=true)
	public Page query(String companyName,String office,String phone,String groupId,DataGridModel dgm){
		Page<CompanyInfoDomain> page = companyInfoDao.query(companyName, office, phone,groupId, dgm);
		return page;
	}
	
	/**
	 * 删除组关联里面的记录
	 * @param ids
	 */
	@Transactional
	public void deleteRelateGroup(String[] ids){
		companyInfoDao.deleteCompanyMember(ids);
	}
	
}
